<!DOCTYPE html>
<html>

<head>
    <title>应用管理</title>
    <!--#include file="common/head.html" -->
</head>

<body class="inner-page">
    <h2>应用管理</h2>

    <div id="vue">
        <admintable api-url="/iam_api/common_api/app">
            <template v-slot="slotProps">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>应用名称</th>
                        <th>应用简介</th>
                        <th>客户端 id</th>
                        <th>客户端秘钥</th>
                        <th>应用类型</th>
                        <th>图标</th>
                        <th>状态</th>
                        <th>创建日期</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tr v-for="(item) in slotProps.list">
                    <td>{{item.id}}</td>
                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{item.name}}</span>
                        <input type="text" v-show="slotProps.data.editingId == item.id" v-model="item.name" />
                    </td>
                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{item.content}}</span>
                        <input type="text" v-show="slotProps.data.editingId == item.id" v-model="item.content" />
                    </td>
                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{item.clientId}}</span>
                        <input type="text" v-show="slotProps.data.editingId == item.id" v-model="item.clientId" />
                    </td>
                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{item.clientSecret}}</span>
                        <input type="text" v-show="slotProps.data.editingId == item.id" v-model="item.clientSecret" />
                    </td>
                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{item.type}}</span>
                        <select v-show="slotProps.data.editingId == item.id" v-model="item.type" style="width:120px">
                            <option value="HTML">Web/H5 页面</option>
                            <option value="APP">安卓/iOS/小程序</option>
                            <option value="API_SERVICE">REST API</option>
                            <option value="RPC_SERVICE">RPC API</option>
                            <option value="MISC">其他</option>
                        </select>
                    </td>
                    <td>
                        <img :src="item.logo" />
                    </td>

                    <td>
                        <span v-show="slotProps.data.editingId != item.id">{{slotProps.data.STAT[item.stat]}}</span>

                        <select v-show="slotProps.data.editingId == item.id" v-model="item.stat" v-model="item.stat"
                            style="width:80px">
                            <option value="0">正常</option>
                            <option value="1">已禁用</option>
                            <option value="2">已删除</option>
                        </select>
                    </td>
                    <td>
                        <admintable-date-column :item="item" />
                    </td>
                    <td>
                        <admintable-date-edit-btns :item="item" :data="slotProps.data" />
                    </td>
                </tr>

                <tr :class="{hide: !slotProps.data.isShowCreate}">
                    <td></td>
                    <td><input type="text" v-model="slotProps.data.create.name" placeholder="租户名称" /></td>
                    <td>
                        <input type="text" v-model="slotProps.data.create.code" placeholder="租户编码" />

                    </td>
                    <td><input type="text" v-model="slotProps.data.create.content" placeholder="租户简介" /></td>
                    <td></td>
                    <td></td>
                    <td>
                        <a href="#" @click="$children[0].doCreate">新增</a> | <a href="#"
                            @click="slotProps.data.isShowCreate = false">取消</a>
                    </td>
                </tr>
            </template>
        </admintable>
    </div>

    <script src="common/component.js"></script>
    <script>
        new Vue({ el: '#vue' });
    </script>
</body>

</html>